import request from '@/utils/httpRequest'

export function fetchList(query) {
  return request({
    url: request.adornUrl('/marketing/coupon/page'),
    method: 'get',
    params: query
  })
}

export function addObj(obj) {
  return request({
    url: request.adornUrl('/marketing/coupon'),
    method: 'post',
    data: obj
  })
}

export function getObj(id) {
  return request({
    url: request.adornUrl('/marketing/coupon/' + id),
    method: 'get'
  })
}

export function delObj(id) {
  return request({
    url: request.adornUrl('/marketing/coupon/' + id),
    method: 'delete'
  })
}

export function putObj(obj) {
  return request({
    url: request.adornUrl('/marketing/coupon'),
    method: 'put',
    data: obj
  })
}

export function getAllCoupon(query) {
  return request({
    url: request.adornUrl('/marketing/coupon/couponCenter'),
    method: 'get',
    params: query
  })
}

export function generatingCouponCode(data) {
  return request({
    url: request.adornUrl('/marketing/coupon/generatingCouponCode'),
    method: 'post',
    data: data
  })
}

export function editCouponNum(data) {
  return request({
    url: request.adornUrl('/marketing/coupon/editCouponNum'),
    method: 'post',
    data: data
  })
}

export function editCouponIsExp(data) {
  return request({
    url: request.adornUrl('/marketing/coupon/editCouponIsExp'),
    method: 'post',
    data: data
  })
}
